/**
 * <copyright>
 * </copyright>
 *
 * $Id$
 */
package ms.jasim.model.items.impl;

import ms.jasim.model.items.*;

import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.EDataType;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.EPackage;

import org.eclipse.emf.ecore.impl.EFactoryImpl;

import org.eclipse.emf.ecore.plugin.EcorePlugin;

/**
 * <!-- begin-user-doc -->
 * An implementation of the model <b>Factory</b>.
 * <!-- end-user-doc -->
 * @generated
 */
public class ItemsFactoryImpl extends EFactoryImpl implements ItemsFactory {
	/**
	 * Creates the default factory implementation.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public static ItemsFactory init() {
		try {
			ItemsFactory theItemsFactory = (ItemsFactory)EPackage.Registry.INSTANCE.getEFactory("http://www.example.org/jasim/items"); 
			if (theItemsFactory != null) {
				return theItemsFactory;
			}
		}
		catch (Exception exception) {
			EcorePlugin.INSTANCE.log(exception);
		}
		return new ItemsFactoryImpl();
	}

	/**
	 * Creates an instance of the factory.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public ItemsFactoryImpl() {
		super();
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public EObject create(EClass eClass) {
		switch (eClass.getClassifierID()) {
			case ItemsPackage.ITEM_LIST: return createItemList();
			case ItemsPackage.TEXT_ITEM: return createTextItem();
			case ItemsPackage.INT_ITEM: return createIntItem();
			case ItemsPackage.GOAL_ITEM: return createGoalItem();
			case ItemsPackage.ACTOR_ITEM: return createActorItem();
			case ItemsPackage.GOAL_LIST_ITEM: return createGoalListItem();
			case ItemsPackage.ACTOR_LIST_ITEM: return createActorListItem();
			case ItemsPackage.PROPERTY_LIST: return createPropertyList();
			case ItemsPackage.OBJECT_PROPERTY: return createObjectProperty();
			case ItemsPackage.OBJECT_PROPERTY_LIST: return createObjectPropertyList();
			case ItemsPackage.PROPERTY_DESCRIPTOR: return createPropertyDescriptor();
			case ItemsPackage.PROPERTY_DESCRIPTOR_LIST: return createPropertyDescriptorList();
			default:
				throw new IllegalArgumentException("The class '" + eClass.getName() + "' is not a valid classifier");
		}
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public Object createFromString(EDataType eDataType, String initialValue) {
		switch (eDataType.getClassifierID()) {
			case ItemsPackage.PLANNING_LEVEL:
				return createPlanningLevelFromString(eDataType, initialValue);
			default:
				throw new IllegalArgumentException("The datatype '" + eDataType.getName() + "' is not a valid classifier");
		}
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public String convertToString(EDataType eDataType, Object instanceValue) {
		switch (eDataType.getClassifierID()) {
			case ItemsPackage.PLANNING_LEVEL:
				return convertPlanningLevelToString(eDataType, instanceValue);
			default:
				throw new IllegalArgumentException("The datatype '" + eDataType.getName() + "' is not a valid classifier");
		}
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public ItemList createItemList() {
		ItemListImpl itemList = new ItemListImpl();
		return itemList;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public TextItem createTextItem() {
		TextItemImpl textItem = new TextItemImpl();
		return textItem;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public IntItem createIntItem() {
		IntItemImpl intItem = new IntItemImpl();
		return intItem;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public GoalItem createGoalItem() {
		GoalItemImpl goalItem = new GoalItemImpl();
		return goalItem;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public ActorItem createActorItem() {
		ActorItemImpl actorItem = new ActorItemImpl();
		return actorItem;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public GoalListItem createGoalListItem() {
		GoalListItemImpl goalListItem = new GoalListItemImpl();
		return goalListItem;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public ActorListItem createActorListItem() {
		ActorListItemImpl actorListItem = new ActorListItemImpl();
		return actorListItem;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public PropertyList createPropertyList() {
		PropertyListImpl propertyList = new PropertyListImpl();
		return propertyList;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public ObjectProperty createObjectProperty() {
		ObjectPropertyImpl objectProperty = new ObjectPropertyImpl();
		return objectProperty;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public ObjectPropertyList createObjectPropertyList() {
		ObjectPropertyListImpl objectPropertyList = new ObjectPropertyListImpl();
		return objectPropertyList;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public PropertyDescriptor createPropertyDescriptor() {
		PropertyDescriptorImpl propertyDescriptor = new PropertyDescriptorImpl();
		return propertyDescriptor;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public PropertyDescriptorList createPropertyDescriptorList() {
		PropertyDescriptorListImpl propertyDescriptorList = new PropertyDescriptorListImpl();
		return propertyDescriptorList;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public PlanningLevel createPlanningLevelFromString(EDataType eDataType, String initialValue) {
		PlanningLevel result = PlanningLevel.get(initialValue);
		if (result == null) throw new IllegalArgumentException("The value '" + initialValue + "' is not a valid enumerator of '" + eDataType.getName() + "'");
		return result;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public String convertPlanningLevelToString(EDataType eDataType, Object instanceValue) {
		return instanceValue == null ? null : instanceValue.toString();
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public ItemsPackage getItemsPackage() {
		return (ItemsPackage)getEPackage();
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @deprecated
	 * @generated
	 */
	@Deprecated
	public static ItemsPackage getPackage() {
		return ItemsPackage.eINSTANCE;
	}

} //ItemsFactoryImpl
